<%@page import="monster.comm.util.SpringApplicationContextFactory"%>
<%@page import="monster.flight.admin.manager.service.admin.Flight_infoService"%>
<%@page import="monster.flight.comm.util.FlightFactory"%>
<%@page import="monster.comm.util.DateUtil"%>
<%@page import="monster.flight.comm.entity.vo.FlightBay"%>
<%@page import="sun.jdbc.rowset.CachedRowSet"%>
<%@page import="monster.flight.comm.entity.vo.Flight_info"%>
<%@page import="monster.comm.database.DBManager"%>
<%@page import="monster.comm.util.SysConstant"%>
<%@page import="monster.comm.util.UserService"%>
<%@page import="monster.comm.util.Tool"%>
<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%@page import="java.net.URLEncoder"%>
<%@page import="java.net.URLDecoder"%>
<%
String STAFF_name=Tool.getRequest("STAFF_name",request);//必传参数
String old_password=Tool.getRequest("old_password",request);//必传参数
String new_password=Tool.getRequest("new_password",request);//必传参数
	
String list="";

UserService user = (UserService) session.getAttribute(SysConstant.SESSION_NAME);//获得session里面的登陆信息
if(1==2){
	out.println("{\"id\":-100,\"name\":\"没有登录\"}");
	return;
}else{
	try{
		DBManager db = new DBManager();	
	    String sql="select 1 from staff_info where is_admin='1' and password='"+old_password+"'";
	    CachedRowSet cr = db.getRowSet(sql);
	    boolean is_update=false;
	    if(cr.next()){//旧密码正确能修改
	    	is_update=true;
	    }
	    if(is_update){
	    	  sql = "update  STAFF_INFO set STAFF_NAME='"+STAFF_name+"',password="+new_password+
	   				"  where  is_admin='1'";
	   							
			db.update(sql);
			list="{\"id\":100}";
	    }else{
	    	list="{\"id\":101}";
	    }
		
	}catch(Exception e){
		 e.printStackTrace();
		 list="{\"id\":-200,\"name\":\"程序异常\"}";
	}
	
	out.println(list);

}
%>
